package com.example.demo.vo

import com.example.demo.dbmodels.TQuestionnaire
import io.swagger.annotations.ApiModelProperty

class QuestionnaireVo {


    @ApiModelProperty("id")
    var id: Int? = null

    @ApiModelProperty("标题")
    var title: String? = null

    @ApiModelProperty("科室id")
    var deptId  : Int? = null

    @ApiModelProperty("科室名称")
    var deptName  : String? = null


    fun getVo(table: TQuestionnaire): QuestionnaireVo {
        table.let {
            val data = QuestionnaireVo()
            data.id = it.id
            data.title = it.title
            data.deptId = it.deptId
            data.deptName = it.deptName
            return data
        }
    }

    fun getListVo(table: List<TQuestionnaire>): List<QuestionnaireVo> {
        table.let {
            val list = mutableListOf<QuestionnaireVo>()
            it.forEach {
                val data = QuestionnaireVo()
                data.id = it.id
                data.title = it.title
                data.deptId = it.deptId
                data.deptName = it.deptName
                list.add(data)
            }
            return list
        }
    }

}